<?php

?>
<div class="art-post">
    <div class="art-post-tl"></div>
    <div class="art-post-tr"></div>
    <div class="art-post-bl"></div>
    <div class="art-post-br"></div>
    <div class="art-post-tc"></div>
    <div class="art-post-bc"></div>
    <div class="art-post-cl"></div>
    <div class="art-post-cr"></div>
    <div class="art-post-cc"></div>
    <div class="art-post-body">
        <div class="art-post-inner art-article">
            <h2 class="art-postheader">[Danh sách quảng cáo]</h2>
            
<form id="fr" action="<?php echo Utility::getSiteUrl(); ?>/ads" method="post">
<input type="button" value="Thêm quảng cáo" onclick="window.location='<?php echo Utility::getSiteUrl();?>/ads/add'" />
<table class="item-list">
	<thead>
		<tr>
			<th>Chọn</th>
			<th>Tên quảng cáo</th>
            <th>Tên đối tác</th>
			<th>Thứ tự</th>
            <th>Tùy chọn</th>
		</tr>
	</thead>
	<tbody>
	<?php
    $size = $ad_list->getSize();
    if($size == 0)
    {
        ?>
    <tr>
        <td colspan="5">Chưa có quảng cáo nào</td>
    </tr>
        <?php
    }
    else
    {
        for($i = 0; $i < $size; $i++)
        {
            $row = $ad_list->getRow($i);
            ?>
    <tr>
        <td><input type="checkbox" name="cb[]" value="<?php echo $row->id; ?>"/></td>
        <td><a href="<?php echo Utility::getSiteUrl() . '/ads
            /edit/' . $row->id;?>" title="Sửa"
               ><?php echo $row->name; ?></a></td>
        <td><?php echo $row->partner_name; ?></td>
        <td><input type="hidden" name="id[]" value="<?php echo $row->id; ?>" /><input type="text" name="order<?php echo $row->id; ?>" value="<?php echo $row->a_order; ?>" style="width:30px;border:2px;"/></td>
        <td>
            <a href="<?php echo Utility::getSiteUrl() . '/ads
            /edit/' . $row->id;?>" title="Sửa"
               class="icon-edit"></a>
            <a href="<?php echo Utility::getSiteUrl() . '/ads/remove/' . $row->id;?>" title="Xóa"
               class="icon-remove"></a>
        </td>
    </tr>
            <?php
        }
        ?>
    <tr>
        <td colspan="5" style="text-align:right">
            <select name="mass_action">
                <option value="">Chọn hành động</option>
                <option value="update_order">Sắp xếp</option>
                <option value="remove">Xóa</option>
            </select>
            <input type="submit" name="btnSubmit" value="Cập nhật"/>
        </td>
    </tr>
        <?php
    }
	?>

	</tbody>
</table>
</form>

        </div>

        <div class="cleared"></div>
    </div>
</div>